package com.touka.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 菜品
 */
@Data
public class Dish implements Serializable {

  @Serial
  private static final long serialVersionUID = 1L;

  private Long id;


  //菜品名称
  private String name;


  //菜品分类id
  private Long categoryId;

  // 菜品分类名称（响应用）
  @TableField(select = false, exist = false)
  private String categoryName;

  //菜品价格
  private BigDecimal price;


  //商品码
  private String code;


  //图片
  private String image;

  // 图片文件
  @TableField(select = false, exist = false) // 不参与查询，不是数据库字段
  private MultipartFile file;

  //描述信息
  private String description;


  // 口味信息（接收用）
  @TableField(select = false, exist = false)
  private String dishFlavors;

  // 口味信息（响应用）
  @TableField(select = false, exist = false)
  private List<DishFlavor> flavors;

  //0 停售 1 起售
  private Integer status;


  //顺序
  private Integer sort;


  @TableField(fill = FieldFill.INSERT)
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime createTime;


  @TableField(fill = FieldFill.INSERT_UPDATE)
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime updateTime;


  @TableField(fill = FieldFill.INSERT)
  private Long createUser;


  @TableField(fill = FieldFill.INSERT_UPDATE)
  private Long updateUser;


  @TableLogic
  //是否删除
  private Integer isDeleted;

}
